package processingExample;

import processing.core.PApplet;

@SuppressWarnings("serial")
public class ProcessingExample2 extends PApplet
{
	int x = 100;
	int y = 100;
	int stage = 1;
	
	public void setup()
	{
		size(100, 100);
		background(0, 0, 255);
	}
	
	public void draw()
	{
		background(0, 0, 255);
		fill(255, 0, 0);
		ellipse(x, y, 50, 50);
		
		if (stage == 1)
		{
			y += 1;
			
			if (y >= 100)
				stage = 2;
		}
		if (stage == 2)
		{
			x += 1;
			
			if (x >= 100)
				stage = 3;
		}
		if (stage == 3)
		{
			y -= 1;
			
			if (y <= 0)
				stage = 4;
		}
		if (stage == 4)
		{
			x -= 1;
			
			if (x <= 0)
				stage = 1;
		}
	}
}